ui: write wasm RPC requests directly into the tokenizer - #7265
Open
LalitMaganti wants to merge 1 commit into
Open
ui: write wasm RPC requests directly into the tokenizer#7265LalitMaganti wants to merge 1 commit into
LalitMaganti wants to merge 1 commit into
Conversation
🎨 Perfetto UI Builds
|
LalitMaganti
force-pushed
the
dev/lalitm/zerocopy-2-wasm
branch
from
August 28, 2026 15:10
7fb0dc7 to
1d2e4ed
Compare
LalitMaganti
force-pushed
the
dev/lalitm/zerocopy-2-wasm
branch
from
August 28, 2026 15:30
1d2e4ed to
8d23a04
Compare
trace_processor_rpc_init() allocated a 32MB request buffer that JS wrote into and C++ copied out of on every chunk. The tokenizer holds a standing reservation instead and hands back the address for the next write, so nothing is copied and it stays at one JS->Wasm call per request. Entry points are resolved once with cwrap() instead of ccall(), which redoes the symbol lookup and argument marshalling on every call. For a numeric signature cwrap() returns the raw wasm export, so this is as direct as it gets: 29.6 ns -> 4.5 ns per call. memory64, vs the staging buffer: trace load -61.5%, queries -23.7% addFunction() was declared as returning void; it returns a function pointer. ccall()'s any[] hid that, cwrap()'s number[] does not.
LalitMaganti
force-pushed
the
dev/lalitm/zerocopy-2-wasm
branch
from
August 28, 2026 15:38
8d23a04 to
537bba2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
trace_processor_rpc_init() allocated a 32MB request buffer that JS wrote into
and C++ copied out of on every chunk. The tokenizer holds a standing
reservation instead and hands back the address for the next write, so nothing
is copied and it stays at one JS->Wasm call per request.
Entry points are resolved once with cwrap() instead of ccall(), which redoes
the symbol lookup and argument marshalling on every call. For a numeric
signature cwrap() returns the raw wasm export, so this is as direct as it gets:
29.6 ns -> 4.5 ns per call.
memory64, vs the staging buffer: trace load -61.5%, queries -23.7%
addFunction() was declared as returning void; it returns a function pointer.
ccall()'s any[] hid that, cwrap()'s number[] does not.